var loadMyOrder = function(pageIndex) {
	if (pageIndex == undefined)
		pageIndex = 1;
	var getUrl = '/wx/pgroup/list/data';

	var data={
		rows:30,
		page:pageIndex,
	}
	if(pageIndex==1)
	{
		$('#tuanlist').html('');
	}
	
	$.ajax({
		type: "get",
		url: getUrl,
		data: data,
		dataType: 'JSON',
		async: false,
		success: function(response) {
			if (response) {
				var json=eval('('+response+')'); 
				//console.log(json);
				var list=json.rows;

				

				$.each(list,function(i,item){
					var html=$("#proinfoT").html();
					var regex=new RegExp('{{id}}','g'); 
						html=html.replace(regex,item._id);
					for(key in item)
					{
						var regex=new RegExp('{{'+key+'}}','g'); 
						html=html.replace(regex,item[key]);
					}


					$('#tuanlist').append(html);
				})


			} else {
				
			}
		},
		error: function() {},
		complete: function() {},
	});

}
$(function() {
	$(".order_tab").find('a').click(function(){

		$(".order_tab").find('a').removeClass('aon');
		$(this).addClass('aon');
		loadMyOrder();
		return false;
	})
	$("#orderType").change(function(){
		loadMyOrder();
	})
	loadMyOrder();
})